#!/usr/bin/python
# --coding:utf-8--


import requests

url = "https://kuwo.cn/search/searchMusicBykeyWord?vipver=1&client=kt&ft=music&cluster=0&strategy=2012&encoding=utf8&rformat=json&mobi=1&issubtitle=1&show_copyright_off=1&pn=0&rn=20&all=%E6%9D%8E%E8%8D%A3%E6%B5%A9"

headers = {
    "user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0"
}


# 利用requests对象的post方法，对指定的url发起请求
# 该方法会返回一个Response对象
res = requests.get(url, headers=headers)
print(type(res))
# 通过Response对象的text方法获取网页的文本信息
print(res.text)
save_file = 'musicKW.txt'
with open(save_file, 'w', encoding='utf-8') as file:
    file.write(res.text)
    print('保存成功！')
